HTML Processing
Previous  Top  Next



Use the following commands and functions to process HTML code.


Commands:

^!InsertHtml
Any text with tokens (^p/^t) (added in v4.8)
Similar to ^!InsertText command, but converts HTML tags to Uppercase, Lowercase, or XHTML format (depending on settings in Options). Inserted code will be indented if the Clipbook option "Indent on Paste" is set. The option can be temporarily overridden with the
^!SetPasteIndent command.

^!InsertWizardHtml Any text with tokens (^p/^t) (added in v4.8)
Similar to ^!InsertHtml command, but removes attributes that have no value. This command is useful when used together with the Clip wizard. It allows the user to leave certain fields blank in the Wizard, and the corresponding tags are then automatically removed before being inserted in the document. Example:
^!InsertWizardHtml <TD ALIGN="" WIDTH="">
will insert the following tag in your document: <TD>

^!RunTidy [i|d] (added in v4.8)
^!RunTidy [Switches]

HTML Tidy is a free utility that cleans HTML code and fixes errors. This new Clip command will send your document text to the HTML Tidy program. The corrected output returned by HTML Tidy is then inserted into the document. The StdError stream is saved in a file called "StdError.err" in NoteTab's application directory, unless another file is specified with the SetStdError Name command. You can use the optional parameter "Switches" to specify Tidy command-line arguments; example:
^!RunTidy -f errs.txt -qiu
If no argument is specified and you have a Tidy.cfg file in the NoteTab folder, then HTML Tidy will be configured according to the settings in that configuration file. If NoteTab does not find the configuration file, it will determine the appropriate switches based on the settings in NoteTab. If you have a Tidy.cfg file, but you want NoteTab to ignore it and use default settings, then use the "d" argument (without the quotes). If you want NoteTab to determine the best settings, but would like to have your tags indented, just use the "i" argument; example:
^!RunTidy i
You can learn more about HTML Tidy and download the latest version by visiting the following Web page:
http://tidy.sourceforge.net/  
The easiest setup is to copy the Tidy program to the NoteTab folder (rename the file to Tidy.exe if necessary), but you may place it anywhere else if you prefer.

^!SetHtmlFormat
[UPPERCASE|LOWERCASE|XHTML] (added in v4.801)
Sets the default format of HTML tags created by NoteTab.


Functions:

^$GetHtmlFormat$ (added in v4.801)
Returns the default format used for creating HTML tags. Possible values are: Uppercase, Lowercase, XHTML.

^$GetHtmlTagAttr("TagStr";Attr[;Format])$ (added in v4.8)
Returns the value of the specified HTML attribute. If the Format parameter is not specified, the result is determined by the settings in NoteTab's Options. Use the Format parameter to control the case of minimized attributes (it has no effect on the value returned for normal attributes). It can have one of the following values: UPPERCASE, LOWERCASE, or XHTML. Example:
^$GetHtmlTagAttr("<DL COMPACT>;Compact;XHTML)$ -> compact
^$GetHtmlTagAttr("<DL COMPACT>;Compact;UPPERCASE)$ -> COMPACT
^$GetHtmlTagAttr("<TD ALIGN="left" WIDTH="250">";Width)$ -> 250


^$GetHtmlTagName("TagStr"[;Format])$ (added in v4.8)
Returns the name of the HTML Tag, either in uppercase or lowercase. If the Format parameter is not specified, the character case is determined by the settings in NoteTab's Options. Use the Format parameter to control the format of HTML tags. It can have one of the following values: UPPERCASE, LOWERCASE, or XHTML. Example:
^$GetHtmlTagName("<TD ALIGN="left" WIDTH="250">";LOWERCASE)$ -> td


^$GetHtmlTagTidy("TagStr"[;Format])$ (added in v4.8)
Returns a properly formatted HTML tag converted to uppercase, lowercase, or XHTML format. If the Format parameter is not specified, the result is determined by the settings in NoteTab's Options. Use the Format parameter to control the format of HTML tags. It can have one of the following values:
UPPERCASE, LOWERCASE, or XHTML. Example:
^$GetHtmlTagTidy("<HR SIZE=2 NOSHADE>";XHTML)$ -> <hr size="2" noshade="noshade" />


^$GetHtmlTextTidy("Str"[;Format])$ (added in v4.8)
Returns the string with HTML tags converted to Uppercase, Lowercase, or XHTML format. If the Format parameter is not specified, the result is determined by the settings in NoteTab's Options. Use the Format parameter to control the format of HTML tags. It can have one of the following values: UPPERCASE, LOWERCASE, or XHTML.

^$GetTidyExe$ (added in v4.8)
Returns full path and name of HTML Tidy application.

^$StrToHtml("Str"[;ConvertLineBreaks[;ConvertEntities]])$ (added in v4.83)
Converts plain text to HTML format. "Str" represents the text you want to convert. Use False for ConvertEntities if you don't want special characters (e.g. ©) to be converted to HTML entities (e.g. &copy;); the default value when omitted is True. Use False for ConvertLineBreaks if you don't want <p> and <br> tags to be inserted at line breaks in the text; the default value when omitted is True. Note that entities are determined based on the standard ANSI character set.


TopStyle
NoteTab now supports Bradsoft's
TopStyle CSS editor, version 1.51 and above -- a program for editing Cascading Style Sheets. You can learn more about this useful program and download the latest version by visiting the following Web page:
http://www.bradsoft.com/redir.asp?id=130  
Note that the TopStyle commands described below are used in the TopStyle library packaged with NoteTab. There is also a convenient TopStyle Clipbar to access the Clip commands.


^!EditStyleSheet
[FileName] (added in v4.8)
Opens the specified style sheet file in TopStyle. If no file name is specified, this command will launch TopStyle without opening a specific style sheet. Note that unlike the EditStyleBlock and EditStyleAttr functions, which block the calling application until the user closes TopStyle, EditStyle Sheet simply executes TopStyle and returns immediately.

^$EditStyleBlock("Str")$ (added in v4.8)
Opens TopStyle in <style>..</style> block editing mode. Returns the updated style block. Note that the "Str" argument should not include the surrounding <style>..</style> tags.

^$EditStyleAttr("Str")$ (added in v4.8)
Opens TopStyle in inline (STYLE attribute) editing mode. Returns the updated style. Note that the contents of the style attribute should only include the value assigned to the style attribute. For example, if you wish to edit the style attribute in the tag <span style="color:blue">, then you should only pass color:blue to this function.

^$IsTopStyleEnabled$ (added in v4.8)
Returns 1 if the TopStyle editor is available through NoteTab, and 0 if it is not.